﻿<ResourceDictionary
	xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" 
	xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
	<!-- Resource dictionary entries should be defined here. -->
	
	<LinearGradientBrush x:Key="NormalBackground" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#626262" Offset="1"/>
		<GradientStop Color="#4c4c4c" Offset="0"/>
	</LinearGradientBrush>
	
	<SolidColorBrush x:Key="NormalOuterBorder" Color="#7a7a7a"/>
	
	<LinearGradientBrush x:Key="OverBackground" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#da5e69" Offset="0"/>
		<GradientStop Color="#d12e27" Offset="1"/>
	</LinearGradientBrush>
	
	<LinearGradientBrush x:Key="ClickBackground" EndPoint="0,1" StartPoint="0,0">
		<GradientStop Color="#d22828" Offset="1"/>
		<GradientStop Color="#b00000" Offset="0"/>
	</LinearGradientBrush>
	
	
		<Style TargetType="{x:Type TreeView}">
			<Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.WindowBrushKey}}"/>
			<Setter Property="BorderBrush" Value="{StaticResource ListBorder}"/>
			<Setter Property="BorderThickness" Value="1"/>
			<Setter Property="Padding" Value="1"/>
			<Setter Property="Margin" Value="5"/>
			<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
			<Setter Property="ScrollViewer.HorizontalScrollBarVisibility" Value="Auto"/>
			<Setter Property="ScrollViewer.VerticalScrollBarVisibility" Value="Auto"/>
			<Setter Property="VerticalContentAlignment" Value="Center"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TreeView}">
						<Border SnapsToDevicePixels="true" x:Name="Bd" BorderBrush="{StaticResource NormalOuterBorder}" BorderThickness="1" Background="{StaticResource NormalBackground}" CornerRadius="4">
							<ScrollViewer Focusable="false" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" Background="Transparent" Padding="{TemplateBinding Padding}" CanContentScroll="false" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
								<ItemsPresenter/>
							</ScrollViewer>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<Style x:Key="TreeViewItemFocusVisual">
			<Setter Property="Control.Template">
				<Setter.Value>
					<ControlTemplate>
						<Rectangle/>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		<PathGeometry x:Key="TreeArrow" Figures="M0,0 L0,6 L6,0 z"/>
		<Style x:Key="ExpandCollapseToggleStyle" TargetType="{x:Type ToggleButton}">
			<Setter Property="Focusable" Value="False"/>
			<Setter Property="Width" Value="16"/>
			<Setter Property="Height" Value="16"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type ToggleButton}">
						<Border Width="16" Height="16" Background="Transparent" Padding="5,5,5,5">
							<Path Fill="Transparent" Stroke="#FF989898" x:Name="ExpandPath" Data="{StaticResource TreeArrow}">
								<Path.RenderTransform>
									<RotateTransform Angle="135" CenterX="3" CenterY="3"/>
								</Path.RenderTransform>
							</Path>
						</Border>
						<ControlTemplate.Triggers>
							<Trigger Property="IsMouseOver" Value="True">
								<Setter Property="Stroke" TargetName="ExpandPath" Value="#FF1BBBFA"/>
								<Setter Property="Fill" TargetName="ExpandPath" Value="Transparent"/>
							</Trigger>
							<Trigger Property="IsChecked" Value="True">
								<Setter Property="RenderTransform" TargetName="ExpandPath">
									<Setter.Value>
										<RotateTransform Angle="180" CenterX="3" CenterY="3"/>
									</Setter.Value>
								</Setter>
								<Setter Property="Fill" TargetName="ExpandPath" Value="#FF595959"/>
								<Setter Property="Stroke" TargetName="ExpandPath" Value="#FF262626"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		
		
		<Style TargetType="{x:Type TreeViewItem}">
			<Setter Property="Background" Value="Transparent"/>
			<Setter Property="HorizontalContentAlignment" Value="{Binding Path=HorizontalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="VerticalContentAlignment" Value="{Binding Path=VerticalContentAlignment, RelativeSource={RelativeSource AncestorType={x:Type ItemsControl}}}"/>
			<Setter Property="Padding" Value="1,0,0,0"/>
			<Setter Property="Foreground" Value="White"/>
			<Setter Property="FocusVisualStyle" Value="{StaticResource TreeViewItemFocusVisual}"/>
			<Setter Property="Template">
				<Setter.Value>
					<ControlTemplate TargetType="{x:Type TreeViewItem}">
						<Grid>
							<Grid.ColumnDefinitions>
								<ColumnDefinition MinWidth="19" Width="Auto"/>
								<ColumnDefinition Width="Auto"/>
								<ColumnDefinition Width="*"/>
							</Grid.ColumnDefinitions>
							<Grid.RowDefinitions>
								<RowDefinition Height="Auto"/>
								<RowDefinition/>
							</Grid.RowDefinitions>
							
							<Border Grid.Column="0" Grid.ColumnSpan="3" Grid.Row="0" SnapsToDevicePixels="true" x:Name="Bd" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Padding="{TemplateBinding Padding}">
							</Border>
							
							
							<ToggleButton x:Name="Expander" Style="{StaticResource ExpandCollapseToggleStyle}" ClickMode="Press" IsChecked="{Binding Path=IsExpanded, RelativeSource={RelativeSource TemplatedParent}}"/>
							<Border Grid.Column="1">
								<ContentPresenter SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}" HorizontalAlignment="{TemplateBinding HorizontalContentAlignment}" x:Name="PART_Header" ContentSource="Header"/>
							</Border>
							<ItemsPresenter x:Name="ItemsHost" Grid.Column="1" Grid.ColumnSpan="3" Grid.Row="1"/>
						</Grid>
						<ControlTemplate.Triggers>
							<Trigger Property="IsExpanded" Value="false">
								<Setter Property="Visibility" TargetName="ItemsHost" Value="Collapsed"/>
							</Trigger>
							<Trigger Property="HasItems" Value="false">
								<Setter Property="Visibility" TargetName="Expander" Value="Hidden"/>
							</Trigger>
							<Trigger Property="IsSelected" Value="true">
								<Setter Property="Background" TargetName="Bd" Value="{StaticResource ClickBackground}"/>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.HighlightTextBrushKey}}"/>
							</Trigger>
							<Trigger Property="IsMouseOver" Value="true">
								<Setter Property="Background" TargetName="Bd" Value="{StaticResource OverBackground}"/>
							</Trigger>
							<MultiTrigger>
								<MultiTrigger.Conditions>
									<Condition Property="IsSelected" Value="true"/>
									<Condition Property="IsSelectionActive" Value="false"/>
								</MultiTrigger.Conditions>
								<Setter Property="Background" TargetName="Bd" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
							</MultiTrigger>
							<Trigger Property="IsEnabled" Value="false">
								<Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.GrayTextBrushKey}}"/>
							</Trigger>
						</ControlTemplate.Triggers>
					</ControlTemplate>
				</Setter.Value>
			</Setter>
		</Style>
		
</ResourceDictionary>